]> git.neil.brown.name Git - wiggle.git/commitdiff
Browser: improve decision on when to split window for merger view.
authorNeil Brown <neilb@suse.de>
Fri, 11 May 2012 09:42:24 +0000 (19:42 +1000)
committerNeil Brown <neilb@suse.de>
Fri, 11 May 2012 09:44:53 +0000 (19:44 +1000)
Now that we are tracking in_conflict in the broswer we "know" when
we are in a conflict and so can only display the split window then,
rather than keeping some hysteresis until we leave any changes behind.
This makes large jumps ('N' 'P') display better.
Also don't allow hunk headers to look like a 'wiggled' section, because
they aren't really.

Signed-off-by: NeilBrown <neilb@suse.de>
vpatch.c

index f32389132c964261a19e1983bf55da91ae618da8..653cdb6676d2770150486c37a974aca618936510 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -575,7 +575,9 @@ static int check_line(struct mpos pos, struct file fm, struct file fb,
                else if ((m[pos.p.m].type == AlreadyApplied ||
                          m[pos.p.m].type == Conflict))
                        rv |= CONFLICTED | CHANGES;
-               else if (m[pos.p.m].type == Extraneous)
+               else if (m[pos.p.m].type == Extraneous &&
+                        /* hunk headers don't count as wiggles */
+                        fb.list[m[pos.p.m].b].start[0] != '\0')
                        rv |= WIGGLED;
                else if (m[pos.p.m].type == Unmatched)
                        unmatched = 1;
@@ -1312,12 +1314,13 @@ static void merge_window(struct plist *p, FILE *f, int reverse)
 
                if (mode == (ORIG|RESULT)) {
                        int cmode = check_line(pos, fm, fb, fa, ci.merger, mode);
-                       if (splitrow < 0 && (cmode & (WIGGLED|CONFLICTED))) {
-                               splitrow = (rows+1)/2;
-                               lastrow = splitrow - 1;
-                               refresh = 1;
-                       }
-                       if (!curs.alt && splitrow >= 0 && !(cmode & CHANGES)) {
+                       if (cmode & (WIGGLED | CONFLICTED)) {
+                               if (splitrow < 0) {
+                                       splitrow = (rows+1)/2;
+                                       lastrow = splitrow - 1;
+                                       refresh = 1;
+                               }
+                       } else if (!curs.alt && splitrow >= 0) {
                                splitrow = -1;
                                lastrow = rows-1;
                                refresh = 1;